import api from '@/api/request'

/**
 * 物业驾驶舱相关API接口
 */

// 检查用户物业公司权限
export function checkPropertyCompanyPermission() {
  return api.get('/api/property/dashboard/check-permission')
}

// 获取驾驶舱完整数据
export function getDashboardData(propertyCompanyId: number) {
  return api.get(`/api/property/dashboard/data/${propertyCompanyId}`)
}

// 获取KPI指标数据
export function getKpiData(propertyCompanyId: number) {
  return api.get(`/api/property/dashboard/kpi/${propertyCompanyId}`)
}

// 获取趋势数据
export function getTrendData(propertyCompanyId: number, months: number = 12) {
  return api.get(`/api/property/dashboard/trend/${propertyCompanyId}`, {
    params: { months }
  })
}

// 获取安全检查数据
export function getInspectionData(propertyCompanyId: number) {
  return api.get(`/api/property/dashboard/inspection/${propertyCompanyId}`)
}

// 获取收费标准数据
export function getBillingStandardData(propertyCompanyId: number) {
  return api.get(`/api/property/dashboard/billing-standard/${propertyCompanyId}`)
}

// 物业驾驶舱API对象
export const propertyDashboardApi = {
  checkPropertyCompanyPermission,
  getDashboardData,
  getKpiData,
  getTrendData,
  getInspectionData,
  getBillingStandardData
}
